<?php
/**
 * Created by PhpStorm.
 * User: HBB-ice
 * Date: 2015/6/10
 * Time: 17:16
 */

namespace Apps\AppApi\Method\BeautyParlor;


use Apps\AppApi\Method\BaseMethod;
use Apps\Common\Models\BeautyParlorComment;

class CommentTotal extends BaseMethod
{
    public function run()
    {
        $id = intval($this->getDataItem('id',0));
        // 评论总数
        $total = BeautyParlorComment::count(
            [
                'conditions' => 'beauty_parlor_id = :bid: and comment_state = 1',
                'bind' => [
                    'bid' => $id,
                ]
            ]
        );

        $this->setResult(["total"=>$total]);
    }
}